require("../../assets/css/normalize.css");
require("../../assets/css/reset.css");
require("../../assets/fonts/iconfont.css");
require("./mine.less");

const { default: axios } = require("axios");
const dom = require("../../utils/dom");

document.addEventListener("DOMContentLoaded", function () {
	dom.renderFtr("mine");

	dom.get(".user").addEventListener("click", function () {
		location.href = "./mine-infor.html";
	});

	dom.get(".data").addEventListener("click", function () {
		location.href = "./mine-data.html";
	});

	dom.get(".badge").addEventListener("click", function () {
		location.href = "./mine-badge.html";
	});

	axios.defaults.baseURL = "http://fitness.h5.itsource.cn:3701";

	let token = localStorage.getItem("token");
	// console.log(token);
	axios.defaults.headers.common["Authorization"] = "Bearer " + token;

	axios.get("/api/user/info").then((res) => {
		console.log(res);
		dom.get("#minute").textContent = res.data.data.duration;
		dom.get("#calorie").textContent = res.data.data.calorie;
	});
});
